package com.qiaoanju.feign;

import com.qiaoanju.domain.UserDomain;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 注意：
 * feign 不支持 @GetMapping
 * @PathVariable 必须得设置
 * 参数是复杂对象，即使指定了是GET方法，feign依然会以POST方法进行发送请求
 */
@FeignClient("qiaoanju-microsofts-eureka-client-provider")
public interface UserFeignClient {

    @RequestMapping(value = "/simple/{id}", method = RequestMethod.GET)
    public UserDomain findById(@PathVariable("id") Long id);

    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public UserDomain postUser(@RequestBody UserDomain user);

    @RequestMapping(value = "/checkUser")
    UserDomain login(@RequestParam Map<String,Object> map);
}
